package com.tpshion.cloud.auth.domain.dto;

import org.springframework.util.StringUtils;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;


/**
 * 查询用户数据
 */
@Valid
public class QueryUserDto {

    @NotNull(message = "pageSize不能为空")
    private int pageSize;

    @NotNull(message = "pageNum不能为空")
    private int pageNum;

    private String username;

    private String phone;

    private String email;

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "QueryUserDto{" +
                "pageSize=" + pageSize +
                ", pageNum=" + pageNum +
                ", username='" + username + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                '}';
    }

    public void init(){
        this.email = StringUtils.isEmpty(this.email) ? this.email : this.email.trim();
        this.phone = StringUtils.isEmpty(this.phone) ? this.phone : this.phone.trim();
        this.username = StringUtils.isEmpty(this.username) ? this.username : this.username.trim();
    }
}
